home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / QuickTime™ 1.0 Interfaces / Components.lisp < prev    next >
Encoding:
Text File  |  1993-09-16  |  11.2 KB  |  292 lines  |  [TEXT/CCL2]

  1.  
  2. (in-package :TRAPS)
  3. ; Created: Wednesday, August 14, 1991 at 12:11 PM
  4. ;  Components.p
  5. ;  Pascal Interface to the Macintosh Libraries
  6. ;  Copyright Apple Computer, Inc. 1990 - 1991
  7. ;  All rights reserved
  8.  
  9. ; $IFC UNDEFINED UsingIncludes
  10. ; $SETC UsingIncludes := 0
  11. ; $ENDC
  12.  
  13. ; $IFC NOT UsingIncludes
  14.  
  15. ; $ENDC
  16.  
  17. ; $IFC UNDEFINED UsingComponents
  18. ; $SETC UsingComponents := 1
  19.  
  20. ; $I+
  21. ; $SETC ComponentsIncludes := UsingIncludes
  22. ; $SETC UsingIncludes := 1
  23. ; $IFC UNDEFINED UsingTypes
  24.  
  25. (require-interface 'TYPES)      ; $I $$Shell(PInterfaces)Types.p
  26. ; $ENDC
  27. ; $SETC UsingIncludes := ComponentsIncludes
  28.  
  29. (defconstant $gestaltComponentMgr :|cpnt|)
  30.  
  31. (defconstant $kAnyComponentType 0)
  32. (defconstant $kAnyComponentSubType 0)
  33. (defconstant $kAnyComponentManufacturer 0)
  34. (defconstant $kAnyComponentFlagsMask 0)
  35.  
  36. (defconstant $cmpWantsRegisterMessage #X80000000)
  37.  
  38. (defrecord ComponentDescription 
  39.    (componentType :OSTYPE)      ;  A unique 4-byte code indentifying the command set 
  40.    (componentSubType :OSTYPE)   ;  Particular flavor of this instance 
  41.    (componentManufacturer :OSTYPE);  Vendor indentification 
  42.    (componentFlags :SIGNED-LONG);  8 each for Component,Type,SubType,Manuf/revision 
  43.    (componentFlagsMask :SIGNED-LONG);  Mask for specifying which flags to consider in search, zero during registration 
  44.    )
  45.  
  46. (defrecord ResourceSpec 
  47.    (resType :OSTYPE)            ;  4-byte code  
  48.    (resId :SIGNED-INTEGER)      ;     
  49.    )
  50.  
  51. (def-mactype :COMPONENTRESOURCEPTR (find-mactype :POINTER))
  52. (def-mactype :COMPONENTRESOURCEHANDLE (find-mactype :HANDLE))
  53. (defrecord (ComponentResource :handle) 
  54.    (cd :COMPONENTDESCRIPTION)   ;  Registration parameters 
  55.    (component :RESOURCESPEC)    ;  resource where Component code is found 
  56.    (componentName :RESOURCESPEC);  name string resource 
  57.    (componentInfo :RESOURCESPEC);  info string resource 
  58.    (componentIcon :RESOURCESPEC);  icon resource 
  59.    )
  60.  
  61. ;  Structure received by Component:  
  62. (defrecord ComponentParameters 
  63.    (flags :CHARACTER)           ;  call modifiers: sync/async, deferred, immed, etc 
  64.    (paramSize :CHARACTER)       ;  size in bytes of actual parameters passed to this call 
  65.    (what :SIGNED-INTEGER)       ;  routine selector, negative for Component management calls 
  66.    (params (:ARRAY :SIGNED-LONG 1));  actual parameters for the indicated routine 
  67.    )
  68.  
  69. (def-mactype :COMPONENT (find-mactype :POINTER))
  70. (defrecord ComponentRecord 
  71.    (data (:ARRAY :SIGNED-LONG 1))
  72.    )
  73.  
  74. (def-mactype :COMPONENTINSTANCE (find-mactype :POINTER))
  75. (defrecord ComponentInstanceRecord 
  76.    (data (:ARRAY :SIGNED-LONG 1))
  77.    )
  78.  
  79. (def-mactype :COMPONENTRESULT (find-mactype :SIGNED-LONG))
  80.  
  81. (def-mactype :COMPONENTROUTINE (find-mactype :SIGNED-LONG))
  82.  
  83. (def-mactype :COMPONENTFUNCTION (find-mactype :SIGNED-LONG))
  84.  
  85. ;  *******************************************************
  86. ; *                                                     *
  87. ; *              APPLICATION LEVEL CALLS                *
  88. ; *                                                     *
  89. ; *******************************************************
  90. ; * Component Database Add, Delete, and Query Routines 
  91. ; *******************************************************
  92. ;  
  93.  
  94. (deftrap _REGISTERCOMPONENT ((CD :COMPONENTDESCRIPTION) (COMPONENTENTRYPOINT :SIGNED-LONG) (GLOBAL :SIGNED-INTEGER) (COMPONENTNAME :HANDLE) (COMPONENTINFO :HANDLE) (COMPONENTICON :HANDLE))
  95.    (:STACK (:POINTER :COMPONENTRECORD))
  96.    (:STACK-TRAP #xA82A :D0 1 CD COMPONENTENTRYPOINT GLOBAL COMPONENTNAME COMPONENTINFO COMPONENTICON))
  97.  
  98. (deftrap _REGISTERCOMPONENTRESOURCE ((TR (:HANDLE :COMPONENTRESOURCE)) (GLOBAL :SIGNED-INTEGER))
  99.    (:STACK (:POINTER :COMPONENTRECORD))
  100.    (:STACK-TRAP #xA82A :D0 18 TR GLOBAL))
  101.  
  102. (deftrap _UNREGISTERCOMPONENT ((ACOMPONENT (:POINTER :COMPONENTRECORD)))
  103.    (:STACK :SIGNED-INTEGER)
  104.    (:STACK-TRAP #xA82A :D0 2 ACOMPONENT))
  105.  
  106.  
  107. (deftrap _FINDNEXTCOMPONENT ((ACOMPONENT (:POINTER :COMPONENTRECORD)) (LOOKING :COMPONENTDESCRIPTION))
  108.    (:STACK (:POINTER :COMPONENTRECORD))
  109.    (:STACK-TRAP #xA82A :D0 4 ACOMPONENT LOOKING))
  110.  
  111. (deftrap _COUNTCOMPONENTS ((LOOKING :COMPONENTDESCRIPTION))
  112.    (:STACK :SIGNED-LONG)
  113.    (:STACK-TRAP #xA82A :D0 3 LOOKING))
  114.  
  115.  
  116. (deftrap _GETCOMPONENTINFO ((ACOMPONENT (:POINTER :COMPONENTRECORD)) (CD :COMPONENTDESCRIPTION) (COMPONENTNAME :HANDLE) (COMPONENTINFO :HANDLE) (COMPONENTICON :HANDLE))
  117.    (:STACK :SIGNED-INTEGER)
  118.    (:STACK-TRAP #xA82A :D0 5 ACOMPONENT CD COMPONENTNAME COMPONENTINFO COMPONENTICON))
  119.  
  120. (deftrap _GETCOMPONENTLISTMODSEED NIL
  121.    (:STACK :SIGNED-LONG)
  122.    (:STACK-TRAP #xA82A :D0 6))
  123.  
  124. ;  *******************************************************
  125. ; * Component Instance Allocation and dispatch routines 
  126. ; *******************************************************
  127. ;  
  128.  
  129. (deftrap _OPENCOMPONENT ((ACOMPONENT (:POINTER :COMPONENTRECORD)))
  130.    (:STACK (:POINTER :COMPONENTINSTANCERECORD))
  131.    (:STACK-TRAP #xA82A :D0 7 ACOMPONENT))
  132.  
  133. (deftrap _CLOSECOMPONENT ((ACOMPONENTINSTANCE (:POINTER :COMPONENTINSTANCERECORD)))
  134.    (:STACK :SIGNED-INTEGER)
  135.    (:STACK-TRAP #xA82A :D0 8 ACOMPONENTINSTANCE))
  136.  
  137.  
  138. (deftrap _GETCOMPONENTINSTANCEERROR ((ACOMPONENTINSTANCE (:POINTER :COMPONENTINSTANCERECORD)))
  139.    (:STACK :SIGNED-INTEGER)
  140.    (:STACK-TRAP #xA82A :D0 10 ACOMPONENTINSTANCE))
  141.  
  142. ;   direct calls to the Components  
  143.  
  144. (deftrap _COMPONENTFUNCTIONIMPLEMENTED ((CI (:POINTER :COMPONENTINSTANCERECORD)) (FTNNUMBER :SIGNED-INTEGER))
  145.    (:STACK :SIGNED-LONG)
  146.    (:STACK-TRAP #xA82A :D0 0 CI FTNNUMBER ((+ (ASH 2 16) 65533) :SIGNED-LONGINT)))
  147.  
  148. (deftrap _GETCOMPONENTVERSION ((CI (:POINTER :COMPONENTINSTANCERECORD)))
  149.    (:STACK :SIGNED-LONG)
  150.    (:STACK-TRAP #xA82A :D0 0 CI ((+ (ASH 0 16) 65532) :SIGNED-LONGINT)))
  151.  
  152. ; ****************************************************
  153. ; *                                                    *
  154. ; *               CALLS MADE BY Components             *
  155. ; *                                                    *
  156. ; ******************************************************
  157. ; ******************************************************
  158. ; * Required Component routines
  159. ; ******************************************************
  160.  
  161. (defconstant $kComponentOpenSelect -1);  ComponentInstance for this open 
  162. (defconstant $kComponentCloseSelect -2);  ComponentInstance for this close 
  163. (defconstant $kComponentCanDoSelect -3);  selector # being queried 
  164. (defconstant $kComponentVersionSelect -4);  no params 
  165. (defconstant $kComponentRegisterSelect -5);  no params 
  166. (defconstant $kComponentTargetSelect -6);  ComponentInstance for top of call chain 
  167.  
  168. ;  *******************************************************
  169. ; * Component Management routines
  170. ; *******************************************************
  171. ;  
  172.  
  173. (deftrap _SETCOMPONENTINSTANCEERROR ((ACOMPONENTINSTANCE (:POINTER :COMPONENTINSTANCERECORD)) (THEERROR :SIGNED-INTEGER))
  174.    NIL
  175.    (:STACK-TRAP #xA82A :D0 11 ACOMPONENTINSTANCE THEERROR))
  176.  
  177.  
  178. (deftrap _GETCOMPONENTREFCON ((ACOMPONENT (:POINTER :COMPONENTRECORD)))
  179.    (:STACK :SIGNED-LONG)
  180.    (:STACK-TRAP #xA82A :D0 16 ACOMPONENT))
  181.  
  182. (deftrap _SETCOMPONENTREFCON ((ACOMPONENT (:POINTER :COMPONENTRECORD)) (THEREFCON :SIGNED-LONG))
  183.    NIL
  184.    (:STACK-TRAP #xA82A :D0 17 ACOMPONENT THEREFCON))
  185.  
  186.  
  187. (deftrap _OPENCOMPONENTRESFILE ((ACOMPONENT (:POINTER :COMPONENTRECORD)))
  188.    (:STACK :SIGNED-INTEGER)
  189.    (:STACK-TRAP #xA82A :D0 21 ACOMPONENT))
  190.  
  191. (deftrap _CLOSECOMPONENTRESFILE ((REFNUM :SIGNED-INTEGER))
  192.    (:STACK :SIGNED-INTEGER)
  193.    (:STACK-TRAP #xA82A :D0 24 REFNUM))
  194.  
  195. ;  *******************************************************
  196. ; * Component Instance Management routines
  197. ; *******************************************************
  198. ;  
  199.  
  200. (deftrap _GETCOMPONENTINSTANCESTORAGE ((ACOMPONENTINSTANCE (:POINTER :COMPONENTINSTANCERECORD)))
  201.    (:STACK :HANDLE)
  202.    (:STACK-TRAP #xA82A :D0 12 ACOMPONENTINSTANCE))
  203.  
  204. (deftrap _SETCOMPONENTINSTANCESTORAGE ((ACOMPONENTINSTANCE (:POINTER :COMPONENTINSTANCERECORD)) (THESTORAGE :HANDLE))
  205.    NIL
  206.    (:STACK-TRAP #xA82A :D0 13 ACOMPONENTINSTANCE THESTORAGE))
  207.  
  208.  
  209. (deftrap _GETCOMPONENTINSTANCEA5 ((ACOMPONENTINSTANCE (:POINTER :COMPONENTINSTANCERECORD)))
  210.    (:STACK :SIGNED-LONG)
  211.    (:STACK-TRAP #xA82A :D0 14 ACOMPONENTINSTANCE))
  212.  
  213. (deftrap _SETCOMPONENTINSTANCEA5 ((ACOMPONENTINSTANCE (:POINTER :COMPONENTINSTANCERECORD)) (THEA5 :SIGNED-LONG))
  214.    NIL
  215.    (:STACK-TRAP #xA82A :D0 15 ACOMPONENTINSTANCE THEA5))
  216.  
  217.  
  218. (deftrap _COUNTCOMPONENTINSTANCES ((ACOMPONENT (:POINTER :COMPONENTRECORD)))
  219.    (:STACK :SIGNED-LONG)
  220.    (:STACK-TRAP #xA82A :D0 19 ACOMPONENT))
  221.  
  222. ;   useful helper routines for convenient method dispatching  
  223.  
  224. (deftrap _CALLCOMPONENTFUNCTION ((PARAMS :COMPONENTPARAMETERS) (FUNC :SIGNED-LONG))
  225.    (:STACK :SIGNED-LONG)
  226.    (:STACK-TRAP #xA82A :D0 255 PARAMS FUNC))
  227.  
  228. (deftrap _CALLCOMPONENTFUNCTIONWITHSTORAGE ((STORAGE :HANDLE) (PARAMS :COMPONENTPARAMETERS) (FUNC :SIGNED-LONG))
  229.    (:STACK :SIGNED-LONG)
  230.    (:STACK-TRAP #xA82A :D0 255 STORAGE PARAMS FUNC))
  231.  
  232. (deftrap _DELEGATECOMPONENTCALL ((ORIGINALPARAMS :COMPONENTPARAMETERS) (CI (:POINTER :COMPONENTINSTANCERECORD)))
  233.    (:STACK :SIGNED-LONG)
  234.    (:STACK-TRAP #xA82A :D0 36 ORIGINALPARAMS CI))
  235.  
  236. ;  Set Default Component flags 
  237. (defconstant $defaultComponentIdentical 0)
  238. (defconstant $defaultComponentAnyFlags 1)
  239. (defconstant $defaultComponentAnyManufacturer 2)
  240. (defconstant $defaultComponentAnySubType 4)
  241. (defconstant $defaultComponentAnyFlagsAnyManufacturer (+ #$DEFAULTCOMPONENTANYFLAGS #$DEFAULTCOMPONENTANYMANUFACTURER))
  242. (defconstant $defaultComponentAnyFlagsAnyManufacturerAnySubType (+ #$DEFAULTCOMPONENTANYFLAGS (+ #$DEFAULTCOMPONENTANYMANUFACTURER #$DEFAULTCOMPONENTANYSUBTYPE)))
  243.  
  244.  
  245. (deftrap _SETDEFAULTCOMPONENT ((ACOMPONENT (:POINTER :COMPONENTRECORD)) (FLAGS :SIGNED-INTEGER))
  246.    (:STACK :SIGNED-INTEGER)
  247.    (:STACK-TRAP #xA82A :D0 30 ACOMPONENT FLAGS))
  248.  
  249. (deftrap _OPENDEFAULTCOMPONENT ((COMPONENTTYPE :OSTYPE) (COMPONENTSUBTYPE :OSTYPE))
  250.    (:STACK (:POINTER :COMPONENTINSTANCERECORD))
  251.    (:STACK-TRAP #xA82A :D0 33 COMPONENTTYPE COMPONENTSUBTYPE))
  252.  
  253. (deftrap _CAPTURECOMPONENT ((CAPTUREDCOMPONENT (:POINTER :COMPONENTRECORD)) (CAPTURINGCOMPONENT (:POINTER :COMPONENTRECORD)))
  254.    (:STACK (:POINTER :COMPONENTRECORD))
  255.    (:STACK-TRAP #xA82A :D0 28 CAPTUREDCOMPONENT CAPTURINGCOMPONENT))
  256.  
  257. (deftrap _UNCAPTURECOMPONENT ((ACOMPONENT (:POINTER :COMPONENTRECORD)))
  258.    (:STACK :SIGNED-INTEGER)
  259.    (:STACK-TRAP #xA82A :D0 29 ACOMPONENT))
  260.  
  261. ;  errors from component manager & components 
  262. (defconstant $invalidComponentID -3000)
  263. (defconstant $validInstancesExist -3001)
  264. (defconstant $componentNotCaptured -3002)
  265. (defconstant $componentDontRegister -3003)
  266.  
  267. (defconstant $badComponentInstance #X80008001)
  268. (defconstant $badComponentSelector #X80008002)
  269.  
  270. ; $ENDC                         ;  UsingComponents 
  271.  
  272. ; $IFC NOT UsingIncludes
  273.  
  274. ; $ENDC
  275.  
  276.  
  277. (export '($BADCOMPONENTSELECTOR $BADCOMPONENTINSTANCE $COMPONENTDONTREGISTER
  278.           $COMPONENTNOTCAPTURED $VALIDINSTANCESEXIST $INVALIDCOMPONENTID
  279.           $DEFAULTCOMPONENTANYFLAGSANYMANUFACTURERANYSUBTYPE
  280.           $DEFAULTCOMPONENTANYFLAGSANYMANUFACTURER $DEFAULTCOMPONENTANYSUBTYPE
  281.           $DEFAULTCOMPONENTANYMANUFACTURER $DEFAULTCOMPONENTANYFLAGS
  282.           $DEFAULTCOMPONENTIDENTICAL $KCOMPONENTTARGETSELECT
  283.           $KCOMPONENTREGISTERSELECT $KCOMPONENTVERSIONSELECT
  284.           $KCOMPONENTCANDOSELECT $KCOMPONENTCLOSESELECT $KCOMPONENTOPENSELECT
  285.           $CMPWANTSREGISTERMESSAGE $KANYCOMPONENTFLAGSMASK
  286.           $KANYCOMPONENTMANUFACTURER $KANYCOMPONENTSUBTYPE $KANYCOMPONENTTYPE
  287.           $GESTALTCOMPONENTMGR))
  288. (provide-interface 'Components)